Description: Align fp IDE template file paths with Debian standards
  The fp IDE looks for template files in /usr/bin where itself is installed.
  However this is not conform with Debian stadard for file locations.
  This patch fixes this by making the IDE looking for templates in the base
  installation directory.
Author: Abou Al Montacir <abou.almontacir@sfr.fr>
Index: fpc/fpcsrc/packages/ide/fpmake.pp
===================================================================
--- fpc.orig/fpcsrc/packages/ide/fpmake.pp
+++ fpc/fpcsrc/packages/ide/fpmake.pp
@@ -282,16 +282,16 @@ begin
         T.Directory:='compiler';
         T.Install:=false;
 
-        P.InstallFiles.Add('fp.ans','$(bininstalldir)');
-        P.InstallFiles.Add('gplprog.pt','$(bininstalldir)');
-        P.InstallFiles.Add('gplunit.pt','$(bininstalldir)');
-        P.InstallFiles.Add('program.pt','$(bininstalldir)');
-        P.InstallFiles.Add('unit.pt','$(bininstalldir)');
-        P.InstallFiles.Add('cvsco.tdf','$(bininstalldir)');
-        P.InstallFiles.Add('cvsdiff.tdf','$(bininstalldir)');
-        P.InstallFiles.Add('cvsup.tdf','$(bininstalldir)');
-        P.InstallFiles.Add('grep.tdf','$(bininstalldir)');
-        P.InstallFiles.Add('tpgrep.tdf','$(bininstalldir)');
+        P.InstallFiles.Add('fp.ans','$(baseinstalldir)/ide');
+        P.InstallFiles.Add('gplprog.pt','$(baseinstalldir)/ide');
+        P.InstallFiles.Add('gplunit.pt','$(baseinstalldir)/ide');
+        P.InstallFiles.Add('program.pt','$(baseinstalldir)/ide');
+        P.InstallFiles.Add('unit.pt','$(baseinstalldir)/ide');
+        P.InstallFiles.Add('cvsco.tdf','$(baseinstalldir)/ide');
+        P.InstallFiles.Add('cvsdiff.tdf','$(baseinstalldir)/ide');
+        P.InstallFiles.Add('cvsup.tdf','$(baseinstalldir)/ide');
+        P.InstallFiles.Add('grep.tdf','$(baseinstalldir)/ide');
+        P.InstallFiles.Add('tpgrep.tdf','$(baseinstalldir)/ide');
         P.InstallFiles.Add('fp32.ico', [win32, win64], '$(bininstalldir)');
 
         with P.Sources do
Index: fpc/fpcsrc/packages/ide/fpini.pas
===================================================================
--- fpc.orig/fpcsrc/packages/ide/fpini.pas
+++ fpc/fpcsrc/packages/ide/fpini.pas
@@ -178,12 +178,12 @@ begin
    end;
 {$endif WINDOWS}
 {$else}
-  SystemIDEDir:=FExpand(DirOf(system.paramstr(0))+'../lib/fpc/'+version_string+'/ide/text');
+  SystemIDEDir:=FExpand(DirOf(system.paramstr(0))+'../lib/fpc/'+version_string+'/ide');
   If Not ExistsDir(SystemIDEdir) Then
     begin
-    SystemIDEDir:=FExpand(DirOf(system.paramstr(0))+'../lib64/fpc/'+version_string+'/ide/text');
+    SystemIDEDir:=FExpand(DirOf(system.paramstr(0))+'../lib64/fpc/'+version_string+'/ide');
     If Not ExistsDir(SystemIDEdir) Then
-      SystemIDEDir:='/usr/lib/fpc/'+version_string+'/ide/text';
+      SystemIDEDir:='/usr/lib/fpc/'+version_string+'/ide';
     end;
   IDEdir:=CompleteDir(FExpand('~/.fp'));
   If Not ExistsDir(IDEdir) Then
Index: fpc/fpcsrc/packages/ide/fptemplt.pas
===================================================================
--- fpc.orig/fpcsrc/packages/ide/fptemplt.pas
+++ fpc/fpcsrc/packages/ide/fptemplt.pas
@@ -280,6 +280,7 @@ begin
   New(Templates, Init(10,10));
   ScanDir('.');
   ScanDir(IDEDir);
+  ScanDir(SystemIDEDir);
 end;
 
 
